package cn.touna.jss.common.properties.config;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * 系统数据源配置，非三方商户信息配置，信息见 @link 投哪配置中心
 * Created by wuwc on 2017/9/8.
 */
@Component
@Scope("singleton")
public class DBProperties {

    private String url;

    private String username;

    private String password;

    private String driverClassName;

    private Integer initialSize;

    private Integer minIdle;

    private Integer maxActive;

    private Integer maxWait;

    private String validationQuery;

    private String filters;

    private Long timeBetweenEvictionRunsMillis;

    private Long minEvictableIdleTimeMillis;

    private String allowIp;

    private String loginName;

    private String loginPassword;

    private String resetEnable;


    public Long getTimeBetweenEvictionRunsMillis() {
        return timeBetweenEvictionRunsMillis;
    }

    @Value("${datasource.timeBetweenEvictionRunsMillis}")
    public void setTimeBetweenEvictionRunsMillis(Long timeBetweenEvictionRunsMillis) {
        this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
    }

    //@DisconfFileItem(name = "datasource.minEvictableIdleTimeMillis", associateField = "minEvictableIdleTimeMillis")
    public Long getMinEvictableIdleTimeMillis() {
        return minEvictableIdleTimeMillis;
    }

    @Value("${datasource.minEvictableIdleTimeMillis}")
    public void setMinEvictableIdleTimeMillis(Long minEvictableIdleTimeMillis) {
        this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
    }

    //@DisconfFileItem(name = "datasource.url", associateField = "url")
    public String getUrl() {
        return url;
    }

    @Value("${datasource.url}")
    public void setUrl(String url) {
        this.url = url;
    }

    //@DisconfFileItem(name = "datasource.username", associateField = "username")
    public String getUsername() {
        return username;
    }

    @Value("${datasource.username}")
    public void setUsername(String username) {
        this.username = username;
    }

    //@DisconfFileItem(name = "datasource.password", associateField = "password")
    public String getPassword() {
        return password;
    }

    @Value("${datasource.password}")
    public void setPassword(String password) {
        this.password = password;
    }

    //@DisconfFileItem(name = "datasource.driverClassName", associateField = "driverClassName")
    public String getDriverClassName() {
        return driverClassName;
    }

    @Value("${datasource.driverClassName}")
    public void setDriverClassName(String driverClassName) {
        this.driverClassName = driverClassName;
    }

    //@DisconfFileItem(name = "datasource.initialSize", associateField = "initialSize")
    public Integer getInitialSize() {
        return initialSize;
    }

    @Value("${datasource.initialSize}")
    public void setInitialSize(Integer initialSize) {
        this.initialSize = initialSize;
    }

    //@DisconfFileItem(name = "datasource.minIdle", associateField = "minIdle")
    public Integer getMinIdle() {
        return minIdle;
    }

    @Value("${datasource.minIdle}")
    public void setMinIdle(Integer minIdle) {
        this.minIdle = minIdle;
    }

    //@DisconfFileItem(name = "datasource.maxActive", associateField = "maxActive")
    public Integer getMaxActive() {
        return maxActive;
    }

    @Value("${datasource.maxActive}")
    public void setMaxActive(Integer maxActive) {
        this.maxActive = maxActive;
    }

    //@DisconfFileItem(name = "datasource.maxWait", associateField = "maxWait")
    public Integer getMaxWait() {
        return maxWait;
    }

    @Value("${datasource.maxWait}")
    public void setMaxWait(Integer maxWait) {
        this.maxWait = maxWait;
    }

    //@DisconfFileItem(name = "datasource.validationQuery", associateField = "validationQuery")
    public String getValidationQuery() {
        return validationQuery;
    }

    @Value("${datasource.validationQuery}")
    public void setValidationQuery(String validationQuery) {
        this.validationQuery = validationQuery;
    }

    //@DisconfFileItem(name = "datasource.filters", associateField = "filters")
    public String getFilters() {
        return filters;
    }

    @Value("${datasource.filters}")
    public void setFilters(String filters) {
        this.filters = filters;
    }

    /*//@DisconfFileItem(name = "druid.allowIp", associateField = "allowIp")
    public String getAllowIp() {
        return allowIp;
    }

    @Value("${datasource.allowIp}")
    public void setAllowIp(String allowIp) {
        this.allowIp = allowIp;
    }

    //@DisconfFileItem(name = "druid.loginName", associateField = "loginName")
    public String getLoginName() {
        return loginName;
    }

    @Value("${druid.loginName}")
    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    //@DisconfFileItem(name = "druid.loginPassword", associateField = "loginPassword")
    public String getLoginPassword() {
        return loginPassword;
    }

    @Value("${druid.loginPassword}")
    public void setLoginPassword(String loginPassword) {
        this.loginPassword = loginPassword;
    }

    //@DisconfFileItem(name = "druid.resetEnable", associateField = "resetEnable")
    public String getResetEnable() {
        return resetEnable;
    }

    @Value("${druid.resetEnable}")
    public void setResetEnable(String resetEnable) {
        this.resetEnable = resetEnable;
    }*/
}
